home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / softwareupdate / system / amigados / amigadoslibrary / open.c < prev    next >
C/C++ Source or Header  |  1996-10-10  |  775b  |  44 lines

  1. /* Open.c   V1.0   93-03-15                        */
  2. /* ROM library: "dos.library/Open", (All versions) */
  3. /* Copyright 1993, Anders Bjerin, Amiga C Club     */
  4.  
  5. #include <dos/dos.h>
  6.  
  7. #include <clib/dos_protos.h>
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10.  
  11. UBYTE *version = "$VER: Open 1.0";
  12.  
  13. int main( int argc, char *argv[] );
  14. int main( int argc, char *argv[] )
  15. {
  16.   BPTR my_file;
  17.  
  18.  
  19.   /* Open a new file: */
  20.   my_file = Open( "RAM:Score.dat", MODE_NEWFILE );
  21.   
  22.   /* OK? */
  23.   if( !my_file )
  24.   {
  25.     /* Could not open the file! */
  26.     printf( "Error! Could not open the file!\n" );
  27.     exit( 20 );
  28.   }
  29.  
  30.   /* The file has now been opened: */
  31.   printf( "File open!\n" );
  32.  
  33.  
  34.   /* - - - */
  35.  
  36.  
  37.   /* Close the file: */
  38.   Close( my_file );
  39.   printf( "File closed!\n" );
  40.  
  41.   exit( 0 );
  42. }
  43.  
  44.